package org.bing.engine.common.message;

public class Message implements java.io.Serializable {
    private static final long serialVersionUID = 1978L;
    public static final String TYPE_IN_ONLY = "in-only";
    public static final String TYPE_IN_OUT = "in-out";
    public static final String TYPE_OUT_ONLY = "out-only";

    private String id;
    private String srcId;
    private String type; // in-only, in-out, out-only
    private String name; // route to handler by name, same name same handler
    private String header;
    private Object body;
    private long time;
    private long ttl;

    public Message() {
        this.type = TYPE_IN_OUT;
    }

    public Message(String type, String name, Object body) {
        this.type = type;
        this.name = name;
        this.body = body;
    }

    @Override
    public String toString() {
        return id + " " + type + ":" + name + " [" + body + "] " + time;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getHeader() {
        return header;
    }

    public void setHeader(String header) {
        this.header = header;
    }

    public Object getBody() {
        return body;
    }

    public void setBody(Object body) {
        this.body = body;
    }

    public long getTime() {
        return time;
    }

    public void setTime(long time) {
        this.time = time;
    }

    public long getTtl() {
        return ttl;
    }

    public void setTtl(long ttl) {
        this.ttl = ttl;
    }

    public String getSrcId() {
        return srcId;
    }

    public void setSrcId(String srcId) {
        this.srcId = srcId;
    }
}
